<route lang="json5" type="page">
{
  layout: 'tabbar',
  style: {
    navigationBarTitleText: '首页',
  },
}
</route>

<template>
  <view>
    <view class="m-3">
      <wd-grid border :column="3">
        <wd-grid-item icon="scan" text="订单送货" @click="handleScan" />
      </wd-grid>
    </view>
  </view>
</template>

<script lang="ts" setup>
import { signatureByQrCode } from '../../service/index-driver/index-driver'

//
const handleScan = () => {
  // 调起条码扫描
  uni.scanCode({
    scanType: ['qrCode'],
    success: async (res) => {
      try {
        const response = await signatureByQrCode(res.result)
        if (response.success) {
          uni.showToast({
            icon: 'none',
            title: '送货成功~',
          })
        } else {
          uni.showToast({
            icon: 'none',
            title: response.message,
          })
        }
      } catch (e) {}
    },
  })
}
</script>

<style lang="scss" scoped>
//
</style>
